package fmod.fmod;

import fmod.javafmod;
import zombie.SoundManager;
import zombie.characters.IsoPlayer;
import zombie.iso.Vector3;
import zombie.network.GameClient;
import zombie.network.GameServer;

/* loaded from: SoundListener.class */
public class SoundListener extends BaseSoundListener {
    public float lx;
    public float ly;
    public float lz;
    private static final Vector3 vec = new Vector3();

    public SoundListener(int i) {
        super(i);
    }

    @Override // fmod.fmod.BaseSoundListener
    public void tick() {
        if (GameServer.bServer) {
            return;
        }
        int i = 0;
        for (int i2 = 0; i2 < IsoPlayer.numPlayers && i2 != this.index; i2++) {
            if (IsoPlayer.players[i2] != null) {
                i++;
            }
        }
        vec.x = -1.0f;
        vec.y = -1.0f;
        vec.normalize();
        if (IsoPlayer.players[this.index] != null && IsoPlayer.players[this.index].Traits.Deaf.isSet()) {
            this.x = -1000.0f;
            this.y = -1000.0f;
            this.z = 0.0f;
        }
        this.lx = this.x;
        this.ly = this.y;
        this.lz = this.z;
        if (!GameClient.bClient || SoundManager.instance.getSoundVolume() > 0.0f) {
            javafmod.FMOD_Studio_Listener3D(i, this.x, this.y, this.z * 3.0f, this.x - this.lx, this.y - this.ly, this.z - this.lz, vec.x, vec.y, vec.z, 0.0f, 0.0f, 1.0f);
        }
        this.lx = this.x;
        this.ly = this.y;
        this.lz = this.z;
    }
}